package com.dandelion.common.dao.auto.mapper;

import com.dandelion.common.dao.auto.pojo.UserSession;
import com.dandelion.common.dao.auto.pojo.UserSessionCriteria;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface UserSessionMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @SelectProvider(type=UserSessionSqlProvider.class, method="countByExample")
    long countByExample(UserSessionCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @DeleteProvider(type=UserSessionSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserSessionCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @Delete({
        "delete from t_user_session",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @Insert({
        "insert into t_user_session (user_id, user_token, ",
        "expire_time, create_time, ",
        "update_time)",
        "values (#{userId,jdbcType=BIGINT}, #{userToken,jdbcType=VARCHAR}, ",
        "#{expireTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(UserSession record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @InsertProvider(type=UserSessionSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(UserSession record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @SelectProvider(type=UserSessionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_token", property="userToken", jdbcType=JdbcType.VARCHAR),
        @Result(column="expire_time", property="expireTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<UserSession> selectByExample(UserSessionCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @Select({
        "select",
        "id, user_id, user_token, expire_time, create_time, update_time",
        "from t_user_session",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_token", property="userToken", jdbcType=JdbcType.VARCHAR),
        @Result(column="expire_time", property="expireTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    UserSession selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @UpdateProvider(type=UserSessionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserSession record, @Param("example") UserSessionCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @UpdateProvider(type=UserSessionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserSession record, @Param("example") UserSessionCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @UpdateProvider(type=UserSessionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UserSession record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_user_session
     *
     * @mbg.generated Wed May 09 22:05:54 CST 2018
     */
    @Update({
        "update t_user_session",
        "set user_id = #{userId,jdbcType=BIGINT},",
          "user_token = #{userToken,jdbcType=VARCHAR},",
          "expire_time = #{expireTime,jdbcType=TIMESTAMP},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(UserSession record);
}